home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Demos / Commander Demo / Commander 2.0.1 Demo / Commander 2.0.1 Demo.rsrc / TEXT_5156_IDLE.txt < prev    next >
Encoding:
Text File  |  1994-08-15  |  1.4 KB  |  26 lines

  1.  IDLE 
  2.                                                                                     Pg 16-6
  3.  
  4.  
  5. Used in compiled databases to release control back to the 4D engine. 4D cannot interrupt code where no 4D commands are called. For instance, a ¬†For loop with millions of iterations cannot be interupted without at least one 4D command. If no 4D commands are needed, use IDLE.
  6.  
  7.  
  8. IDLE is designed only for 4D COMPILER. This command is useful only in compiled databases when user defined procedures are written such that no calls are made back to the 4th DIMENSION engine. For instance, if a procedure has a For loop in which no 4th DIMENSION commands are executed, the loop could not be interrupted by a process installed with ON¬†SERIAL¬†PORT¬†CALL or ON¬†EVENT¬†CALL nor could a user switch to another application under MultiFinder. In this case IDLE should be inserted to allow 4th DIMENSION to trap events. Of course if you do not want any interruptions, IDLE can be left out.
  9.  
  10.  
  11. In the following example the loop would never terminate in a compiled database without the call to IDLE:
  12.  
  13.     ON EVENT CALL ("EventProc") 
  14.     $Done:=False 
  15.     MESSAGE ("Processing..."+Char (13)+"Type any key to 
  16.                  interrupt...") 
  17.     Repeat    `  Do some processing that doesn't involve a 4D command. 
  18.        IDLE 
  19.     Until ($Done)
  20.  
  21.  
  22.  
  23. See also: ¬†Char, ¬†For, ¬†MESSAGE, ON¬†EVENT¬†CALL, 
  24.                ON¬†SERIAL¬†PORT¬†CALL, ¬†Repeat
  25.  
  26.